#include "Td_object.h"
#include "totem_obj_config.h"

using namespace totem_destroyer;

extern void chipmunk_test(SpaceMgr * spaceManager, bool repeat = false);

extern boost::scoped_ptr<SpaceMgr> g_spaceMgr;

namespace test{
	void initial(bool repeat = false)
	{
		g_spaceMgr.reset(new SpaceMgr);
		chipmunk_test(g_spaceMgr.get(), repeat);
	}

	void step(float_t dt)
	{
		const int step = 10;
		dt /= step;
		for (int i = 0; i < step; i++) g_spaceMgr->update(dt);
		
	}

	void display()
	{
		g_spaceMgr->display();
	}
	void removeShapeBody(cpShape *shape, void *data)
	{
		g_spaceMgr->remove_shape(shape);
	}

	class Ctest {
	public:
		Ctest() {
#ifdef WIN32
		_CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
		//_CrtSetBreakAlloc(126);
		//_CrtSetBreakAlloc(145);
		//_CrtSetBreakAlloc(638);

#endif // WIN32
		}
	};

	Ctest g_test;

};